﻿//---------------------------------------------------------------------
//Copyright (c) 2009, Pierre Milet
//All rights reserved.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
//INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
//OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
//TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
//---------------------------------------------------------------------




//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using BizMock;
using Microsoft.BizTalk.ExplorerOM;

   
namespace BizMock.Tests
{

    #region Single Message Verifiers Type Definitions

    public partial class SimpleSchemaTypeVerifier: XmlMessageVerifierArtifact
    {
        public SimpleSchemaTypeVerifier()
        {
            this.Schema = new BizMock.Samples.SimpleSchema().Schema;
        }

        public string Field
        {
            set
            {
                this.ExpectedValue("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public int FieldCount
        {
            set
            {
                this.ExpectedCount("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public int FieldChildCount
        {
            set
            {
                this.ExpectedChildCount("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public void FieldList( params string[] values )
        {
            this.ExpectedValueList("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema']/*[local-name()='Field' and namespace-uri()='']", values);
        }
        
  }
    
    public partial class SimpleSchemaTypeVerifier2: XmlMessageVerifierArtifact
    {
        public SimpleSchemaTypeVerifier2()
        {
            this.Schema = new BizMock.Samples.SimpleSchema2().Schema;
        }

        public string Field
        {
            set
            {
                this.ExpectedValue("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema2']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public int FieldCount
        {
            set
            {
                this.ExpectedCount("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema2']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public int FieldChildCount
        {
            set
            {
                this.ExpectedChildCount("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema2']/*[local-name()='Field' and namespace-uri()='']", value);
            }
        }

	public void FieldList( params string[] values )
        {
            this.ExpectedValueList("/*[local-name()='Root' and namespace-uri()='http://SimpleSchema2']/*[local-name()='Field' and namespace-uri()='']", values);
        }
        
  }
    
    #endregion       
	#region Multipart Message Verifiers Type Definitions   
		
	public partial class MultiPartVerifier : MessageVerifierBase, IMultiPartVerifier	
    {  
				
		private SimpleSchemaTypeVerifier _MultiPart1 = new SimpleSchemaTypeVerifier();	
		public SimpleSchemaTypeVerifier MultiPart1{get{ return _MultiPart1;}}					
				
		private SimpleSchemaTypeVerifier2 _MultiPart2 = new SimpleSchemaTypeVerifier2();	
		public SimpleSchemaTypeVerifier2 MultiPart2{get{ return _MultiPart2;}}					
		    
		public MessageVerifierBase[] Verifiers
        {
            get { return new MessageVerifierBase[] { _MultiPart1,_MultiPart2 }; }
        } 
	
    }  
    
        #endregion
    
    #region Single Message Instance Type Definitions   
    
    		
	 public partial class SimpleMessageType: BizMockMessage
	 {
        public SimpleMessageType( string file) : base( file )
        {
        }        
        	
				
		public SimpleMessageType ChangeField( string value )
        {
	        this.FindXmlNodeAndReplace(0,"/*[local-name()='Root' and namespace-uri()='http://SimpleSchema']/*[local-name()='Field' and namespace-uri()='']", value);
            return this;
        }	
          	
			
		public object InterchangeID	
		{	
			set
			{
				this.Promote( "InterchangeID", "http://schemas.microsoft.com/BizTalk/2003/system-properties", value );
					
			}	
		}
				
          		
     }								        
					
	 public partial class SimpleMessageType2: BizMockMessage
	 {
        public SimpleMessageType2( string file) : base( file )
        {
        }        
        	
				
		public SimpleMessageType2 ChangeField( string value )
        {
	        this.FindXmlNodeAndReplace(0,"/*[local-name()='Root' and namespace-uri()='http://SimpleSchema2']/*[local-name()='Field' and namespace-uri()='']", value);
            return this;
        }	
          		
     }								        
					
	 public partial class Service1RequestType: BizMockMessage
	 {
        public Service1RequestType( string file) : base( file )
        {
        }        
        	
			
		public object InterchangeID	
		{	
			set
			{
				this.Promote( "InterchangeID", "http://schemas.microsoft.com/BizTalk/2003/system-properties", value );
					
			}	
		}
				
          		
     }								        
			    
    #endregion
    #region MultiPart Message Instance Type Definitions   
        
     
    public partial class MultiPartMessageType : BizMockMessage
    {     
		public MultiPartMessageType(params string[] files):base( files)
        {
         			
			MultiPart1 = new SimpleMessageType( files[0]);		
					
			MultiPart2 = new SimpleMessageType2( files[1]);		
		       
        }       
    		
		public SimpleMessageType MultiPart1{get;set;}		
				
		public SimpleMessageType2 MultiPart2{get;set;}		
		    
        		
		public object InterchangeID	
		{	
			set
			{
				this.Promote( "InterchangeID", "http://schemas.microsoft.com/BizTalk/2003/system-properties", value );
					
			}	
		}
		
    }
       
    #endregion
    
	#region Custom Database Type Definitions

	#endregion
	
	#region Artifacts declaration

    public class Artifacts
    {
	
        #region Message Verifiers
        
        
        public SimpleSchemaTypeVerifier Vrf_Simple = new SimpleSchemaTypeVerifier();
        
        
        public SimpleSchemaTypeVerifier2 Vrf_Simple2 = new SimpleSchemaTypeVerifier2();
        
        
        public MultiPartVerifier Vrf_Multipart = new MultiPartVerifier();
        
        
        public FlatMessageVerifier Vrf_Flat = new FlatMessageVerifier();
        #endregion                               
        
        #region Message Instances
        public SimpleMessageType Msg_Simple = new SimpleMessageType("simpleschema_input.xml");
        public SimpleMessageType2 Msg_Simple2 = new SimpleMessageType2("simpleschema2_input.xml");
        public MultiPartMessageType Msg_MultiPart = new MultiPartMessageType("simpleschema_input.xml","simpleschema2_input.xml");
        public Service1RequestType Msg_ServiceRequest = new Service1RequestType("service1_request.xml");
        #endregion

        #region Maps
        #endregion

        #region Database artifacts
        #endregion

        #region Event Logs
        public EventLogArtifact BizMock_EventLog = new EventLogArtifact("Application", "BizMock");
        #endregion

        #region Ports
 

		public SolicitResponsePortArtifact GetDataService = new SolicitResponsePortArtifact( "BizMock_GetDataService", "", "", "", "", 30, true ); 
      
	   

		public SolicitResponsePortArtifact TWPort_2 = new SolicitResponsePortArtifact( "BizMock_TWPort_2", "", "", "", "", 30, false ); 
      
	  
		public RequestResponseLocationArtifact TWPort_1 = new RequestResponseLocationArtifact( "BizMock_TWPort_1", "", "", "", "", 30 ); 

      
	  	public SendPortArtifact GetDataOutput = new SendPortArtifact ( "BizMock_GetDataOutput", "", "", 30, false  ); 

      
	  	public SendPortArtifact OWPort_2 = new SendPortArtifact ( "BizMock_OWPort_2", "", "", 30, false  ); 

      
		public ReceiveLocationArtifact GetDataInput = new ReceiveLocationArtifact ( "BizMock_GetDataInput", "", "", 30 ); 
      
		public ReceiveLocationArtifact OWPort_1 = new ReceiveLocationArtifact ( "BizMock_OWPort_1", "", "", 30 ); 
      
		public ReceiveLocationArtifact OneWayDirect = new ReceiveLocationArtifact("BizMock_ONEWAY_DIRECT",60);

        public RequestResponseLocationArtifact TwoWayDirect = new RequestResponseLocationArtifact("BizMock_TWOWAY_DIRECT", 60); 

        #endregion

        #region Orchestrations
        
		public OrchestrationArtifact MultipartWithLoopOrchestration;
        
		public OrchestrationArtifact TwoWayPortsOrchestration;
        
		public OrchestrationArtifact ConsumeWebServiceOrchestration;
 
        #endregion

		#region Intitialize

        public void Initialize( bool stopAll )
        {			
		    Application application = BizTalkExplorerHelper.GetApplication("BizMock");
			
			if (stopAll)
            {
                BizTalkExplorerHelper.StopSendPorts(application);
                BizTalkExplorerHelper.DisableReceiveLocations(application);
                BizTalkExplorerHelper.StopAllOrchestrations(application);
            }

			List<IDeployPort> ports = new List<IDeployPort>();

 

			ports.Add( GetDataService);      
	   

			ports.Add( TWPort_2);      
	  
			ports.Add( TWPort_1);
      
			ports.Add( GetDataOutput);
      
			ports.Add( OWPort_2);
      
			ports.Add( GetDataInput);
      
			ports.Add( OWPort_1);
      		
			ports.Add( OneWayDirect );

			ports.Add( TwoWayDirect );
  
			BizTalkExplorerHelper.CreatePorts( application, ports );

			MultipartWithLoopOrchestration = new OrchestrationArtifact(application,"BizMock.Samples.MultipartWithLoop",new List<IDeployPort>(){  }, new Dictionary<string, string>() { {"BizMock_OWPort_1","Port_1"},{"BizMock_OWPort_2","Port_2"} });

 			TwoWayPortsOrchestration = new OrchestrationArtifact(application,"BizMock.Samples.TwoWayPorts",new List<IDeployPort>(){  }, new Dictionary<string, string>() { {"BizMock_TWPort_1","Port_1"},{"BizMock_TWPort_2","Port_2"} });

 			ConsumeWebServiceOrchestration = new OrchestrationArtifact(application,"BizMock.Samples.ConsumeWebService",new List<IDeployPort>(){  }, new Dictionary<string, string>() { {"BizMock_GetDataInput","Port_2"},{"BizMock_GetDataOutput","Port_3"},{"BizMock_GetDataService","Port_1"} });

 			BizTalkExplorerHelper.StartHostInstances();
      }

    #endregion
   
   }
   
    #endregion

}